package com.example.shixun.utils;

import com.example.shixun.controller.UserController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Controller;

import java.util.Map;

@Component
public class GetIdByToken {
    @Autowired
    UserController userController;
    public Integer getIdByToken(String token){
        return userController.getId(token);
    }
    public String getNameByToken(String token){
        Map<String, Object> map= (Map<String, Object>) userController.info(token).getData();
        System.out.println(map);
        return (String) map.get("name");
    }
}
